[9.4] [Console] Preserve spaces in URL query strings (#270881)#271190
Merged
Conversation
Closes elastic#227733 ## Summary - Preserves unquoted spaces in Console URL query values instead of treating them as request-line trailing text. - Keeps inline `//` and `#` comment stripping for request URLs. - Adds focused edge-case coverage for the helper and the full `parseLine` request-line path. ## Root Cause - `removeTrailingWhitespaces` stopped at the first unquoted space, so `GET myindex/_search?q=type:organisation AND elastic` was truncated before `AND elastic`. ## Fix - Use the first `?` outside quotes as the query-string boundary. - Preserve spaces inside query values unless the space starts a trailing inline `//` or `#` comment. - Preserve the existing leading-space behavior and ignore comment markers inside quoted query values. ## Before <img width="1494" height="1313" alt="image" src="https://github.com/user-attachments/assets/5ff9ebfe-dc42-4904-a87d-976dbadc2823" /> ## After <img width="1482" height="1365" alt="image" src="https://github.com/user-attachments/assets/cf4bb6b3-56cf-4a39-9932-5d69f2a3cb95" /> ## Test Plan - [x] `node scripts/jest src/platform/plugins/shared/console/public/application/containers/editor/utils/tokens_utils.test.ts` - [x] `node scripts/eslint src/platform/plugins/shared/console/public/application/containers/editor/utils/tokens_utils.ts src/platform/plugins/shared/console/public/application/containers/editor/utils/tokens_utils.test.ts` - [x] `node scripts/type_check --project src/platform/plugins/shared/console/tsconfig.json` - [x] `node scripts/check_changes.ts` - [x] Manually verified in Console that unquoted query spaces are preserved, trailing `//` and `#` comments are stripped, comment markers inside quoted query values are preserved, quoted `?` path text is not treated as the query delimiter, and trailing non-query text is trimmed before sending the request. Assisted with Cursor using GPT-5.5 Co-authored-by: Cursor <cursoragent@cursor.com> (cherry picked from commit 9d7d161)
5 tasks
Contributor
Author
💛 Build succeeded, but was flaky
Failed CI StepsTest Failures
Metrics [docs]Async chunks
cc @kapral18 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Backport
This will backport the following commits from
mainto9.4:Questions ?
Please refer to the Backport tool documentation